/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.subsystems;

import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.templates.RobotMap;
import edu.wpi.first.wpilibj.templates.commands.DriveBoth;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/**
 *
 * @author Hutch
 */
public class DriveTrain extends Subsystem {
    RobotDrive drive;
    
    
    /*
     * the default current state of the drive train aka driving or not driving 
     */
    private static DriveTrain instance = null;
    
       public void initDefaultCommand() {
        // Set the default command for a subsystem here.
        //setDefaultCommand(new MySpecialCommand());
           setDefaultCommand(new DriveBoth());
           
    }
       
       /*
        * Calls the robotmap and sets the correct ports on the digital sidecar
        * to be called when drive is called
        */
       public DriveTrain(){
           drive = new RobotDrive(RobotMap.CIMmotor1, RobotMap.CIMmotor2);
           drive.setSafetyEnabled(false);
              SmartDashboard.putData(DriveTrain.getInstance());
       }
       
       /*
        * returns the current instance. Changes the other from null
        */
       public static DriveTrain getInstance() {
           if (instance == null) {
               instance = new DriveTrain();
           }
           return instance;
        
           
       }

       /*
        * You have to list all the commands that the subsystem an do here
        * 
        * 
        * arcadeDrive is the drive system we are using. Arcade drive means one
        * joystick is used to drive. The other method is called tankDrive which
        * uses two joysticks to drive the robot
        */
       public void DriveBoth(double y, double x){
           drive.arcadeDrive(y,x,false);
           System.out.println("driveWithJoystick");
       }

}
